<?php
include "../function.php";
$pro=new Product();

if($_GET['request'] == 1){
	$id = $_GET['id'];
	$val = $_GET['val'];
	$ac = $_GET['ac'];
	$info = $pro->getAllByField('id',$id);
	if($ac == 'shelves' && $info['state'] == 0){echo $pro->updateProduct(array("state" => 1),'id',$id);exit();}
	if($ac == 'shelves' && $info['state'] > 0){echo $pro->updateProduct(array("state" => 0),'id',$id);exit();}
	if($ac == 'recommend' && $info['state'] < 2){echo $pro->updateProduct(array("state" => 2,"hot_time" => date("Y-m-d H:i:s",time())),'id',$id);exit();}
	if($ac == 'recommend' && $info['state'] == 2){echo $pro->updateProduct(array("state" => 1),'id',$id);exit();}
}
?>